/*
* Poppy Game Engine - https://pgetemplate.googlecode.com/svn/
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* Copyright (c) 2008 Poppy
*/

#pragma once

#include "ITimer.h"

namespace PGESystem
{

	class TimerList;

	class PGESYSTEM_API CTime : public CMemObject
	{

	public:

		CTime();

		bool InitTime( TIME_UNIT unit = MSEL );

		void DestoryTime();

		inline TIME_UNIT GetTimeUnit();

		inline const float& GetTimeBeforeLastTime() const;
		
		void Time();

		bool AddTimer( LPITIMER* timer );

		inline virtual ~CTime();

	protected:

		void UpdateTimer();

		TimerList* m_pTimerList;
		float m_fTimeBeforeLastTime, m_fChangeRote;
		bool m_bIsInited;
		TIME_UNIT m_eUnit;

		PGE_TICK_RESOLUTION	m_dTickResolution;
		PGE_CURRENT_TICK	m_dLastTick, m_dCurrentTick, m_dDeltaTick;

	};

	#include "CTime.inl"

}
